import time
from selenium import webdriver
from selenium.webdriver.common.by import By
# 导入select类
from selenium.webdriver.support.select import Select

# 第一种 select方式
# 打开浏览器访问网址
driver = webdriver.Chrome()
driver.get("https://sahitest.com/demo/selectTest.htm")
# 创建select对象,参数是要操作的select标签
s1 = driver.find_element(By.ID, "s1")
select = Select(s1)
# 选择option
time.sleep(2)
select.select_by_index(2)
time.sleep(2)

time.sleep(2)
select.select_by_value("49")
time.sleep(2)

time.sleep(2)
select.select_by_visible_text("Email")
time.sleep(2)

driver.quit()